clear all
set more off

use "Data/AnalysisData/final_analysis_data.dta", clear

*STATE Variable*

log using "Output/DataAppendixOutput/state_frequency.txt", text replace

tabulate state, sort

log close

graph bar (count), over(state, sort(ascending) label(angle(90) labsize(small))) bar(1, color(blue)) title("Number of Observations by State") ytitle("Count") legend(off)

graph export "Output/DataAppendixOutput/bar_state.png", replace

*YEAR Variable*

* Open log file for year table
log using "Output/DataAppendixOutput/year_frequency.log", replace text

* Make clean frequency table for 'year'
tabulate year, sort

* Bar graph for 'year' variable BEFORE collapsing
graph bar (count), over(year, sort(ascending) label(angle(0) labsize(medium))) bar(1, color(blue)) title("Number of Observations by Year") ytitle("Count") legend(off)

* Save bar chart
graph export "Output/DataAppendixOutput/bar_year.png", replace

* Now create a mini frequency table
contract year
sort year

* Display clean frequency table
list year _freq, clean

* Close log file
log close

*STATE MINIMUM WAGE Variable*

* 1. Close any existing log file
cap log close

* 2. Open new log file
log using "Output/DataAppendixOutput/state_min_wage_frequency.txt", text replace

* 3. Reload clean dataset
use "Data/AnalysisData/final_analysis_data.dta", clear

* 4. Clean frequency table
tabulate state_min_wage, sort

* 5. Contract to create small dataset for graphing
contract state_min_wage
sort state_min_wage

* 6. List table nicely
list state_min_wage _freq, clean

* 7. Close log file
log close

* Bar graph using _freq
graph bar (sum) _freq, over(state_min_wage, sort(ascending) label(angle(90) labsize(vsmall))) bar(1, color(blue)) title("Distribution of State Minimum Wages") ytitle("Number of Observations") legend(off)

* Save graph
graph export "Output/DataAppendixOutput/bar_state_min_wage.png", replace

*Employment-Population Variable*

* 1. Close any existing log file
cap log close

* 2. Open new log file
log using "Output/DataAppendixOutput/employment_population_ratio_frequency.txt", text replace

* 3. Reload clean dataset (to be safe)
use "Data/AnalysisData/final_analysis_data.dta", clear

* 4. Make simple histogram for continuous variable
histogram employment_population_ratio, width(2) frequency color(blue) title("Histogram of Employment-to-Population Ratio") xtitle("Employment-to-Population Ratio (%)") ytitle("Number of Observations") graphregion(color(white))

* 5. Save histogram
graph export "Output/DataAppendixOutput/hist_employment_population_ratio.png", replace

* 6. Summarize basic stats
summarize employment_population_ratio

* 7. Close log file
log close

*Labor Force Participation Variable*

* 1. Close any existing log file
cap log close

* 2. Open new log file
log using "Output/DataAppendixOutput/labor_force_participation_rate_summary.txt",text replace

* 3. Reload clean dataset (to be safe)
use "Data/AnalysisData/final_analysis_data.dta", clear

* 4. Make simple histogram for continuous variable
histogram labor_force_participation_rate, width(2) frequency color(blue) title("Histogram of Labor Force Participation Rate") xtitle("Labor Force Participation Rate (%)") ytitle("Number of Observations") graphregion(color(white))

* 5. Save histogram
graph export "Output/DataAppendixOutput/hist_labor_force_participation_rate.png",replace

* 6. Summarize basic stats
summarize labor_force_participation_rate

* 7. Close log file
log close

*Unemployment Rate Variable*

* 1. Close any existing log file
cap log close

* 2. Open new log file
log using "Output/DataAppendixOutput/unemployment_rate_summary.txt", text replace

* 3. Reload clean dataset (to be safe)
use "Data/AnalysisData/final_analysis_data.dta", clear

* 4. Make simple histogram for continuous variable
histogram unemployment_rate, width(1) frequency color(blue) title("Histogram of Unemployment Rate") xtitle("Unemployment Rate (%)") ytitle("Number of Observations") graphregion(color(white))

* 5. Save histogram
graph export "Output/DataAppendixOutput/hist_unemployment_rate.png", replace

* 6. Summarize basic stats
summarize unemployment_rate

* 7. Close log file
log close
